package com.springboot.example.monitor.dao.impl;

import com.springboot.example.monitor.dao.UserDao;
import com.springboot.example.monitor.mapper.UserMapper;
import com.springboot.example.monitor.domain.db.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
 * User
 * <p/>
 * User: guoyao
 * DateTime: 2016-02-23 16:23:51
 */
@Service("userDao")
public class UserDaoImpl implements UserDao {

    @Resource
    private UserMapper userMapper;

    /**
     * 根据主键查询User对象
     *
     * @param userId
     * @return User对象
     */
    @Override
    public User selectByPrimaryKey(Long userId) {
        return userMapper.selectByPrimaryKey(userId);
    }

    /**
     * 根据查询条件查询符合条件的User对象
     *
     * @param user
     * @return 符合条件的User对象List
     */
    @Override
    public List<User> select(User user) {
        return userMapper.select(user);
    }

    /**
     * 根据主键删除User对象
     *
     * @param userId
     * @return 影响条件数
     */
    @Override
    public int deleteByPrimaryKey(Long userId) {
        return userMapper.deleteByPrimaryKey(userId);
    }

    /**
     * 根据条件删除符合条件的User对象
     *
     * @param user
     * @return 影响条件数
     */
    @Override
    public int delete(User user) {
        return userMapper.delete(user);
    }

    /**
     * 插入User对象
     *
     * @param user
     * @return 影响条件数
     */
    @Override
    public int insert(User user) {
        return userMapper.insert(user);
    }

    /**
     * 更新User对象
     *
     * @param user
     * @return 影响条件数
     */
    @Override
    public int update(User user) {
        return userMapper.update(user);
    }
}
